<template>
	<view class="list" v-if="list.length > 0">
		<navigator :url="'/pages/article/productDetails?id=' + item.id" class="item" v-for="(item, index) in list" :key="index"
			hover-class="none">
			<view class="info">
				<view class="photo">
					<image :src="item.pic" mode="widthFix"></image>
				</view>
				<view class="text">
					<view class="other">
						<view class="left">
							<view class="source" v-if="item.promotionType==1">￥<text>{{item.promotionPrice}}</text></view>
							<view class="source" v-else>￥<text>{{item.price}}</text></view>
						</view>
						<view class="right" v-if="item.promotionType==1">
							<text>¥ {{item.price | unitConverter}}</text>
						</view>
					</view>
				<!-- 	<view class="infoWholesale">
						促销价 ¥ 20.0
					</view> -->
					<view class="title">
					<!-- <text class="listType">
						自营
					</text>	 -->
					{{ item.name }}
					
					</view>
				<!-- 	<view class="infoType">
						<view class="">
							1件9折
						</view>
						<view class="">
							2件5折
						</view>
					</view> -->
				</view>

			</view>
		</navigator>
	</view>
	<view v-else class="nullList">
		<image src="/static/images/productDetails/nullList.png" mode=""></image>
		<view class="">
			暂无商品
		</view>
		
	</view>
</template>

<script>
	export default {
		name: 'articleList',
		props: {
			list: {
				type: Array,
				default: function(e) {
					return [];
				}
			}
		}
	};
</script>

<style lang="scss">
	/*文章列表*/
	.list {
		width: 100%;
		padding: 25rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		flex-wrap: wrap;

		.item {
			width: 48.5%;
			background-color: #fff;
			margin-bottom: 20rpx;
			border-radius: 32rpx 32rpx 32rpx 32rpx;
			overflow: hidden;
			box-shadow: 0px 0px 10rpx 8rpx rgba(105,84,213,0.03);
			.info {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				padding-bottom: 4rpx;
				flex-direction: column;

				.text {
					flex-grow: 1;
					flex-shrink: 1;
					display: flex;
					flex-direction: column;
					padding: 20rpx;
					padding-top: 0;
					width: 100%;
					box-sizing: border-box;
					.infoType{
						display: flex;
						font-size: 20rpx;
						color: #6954D5;
						margin-top: 10rpx;
						view{
							border: #6954D5 2rpx solid;
							margin-right: 10rpx;
							border-radius: 10rpx;
							padding: 0 15rpx;
							
						}
					}
					.infoWholesale {
						color: #999;
						font-size: 20rpx;
					}

					.title {
						font-size: 20rpx;
						display: -webkit-box;
						text-overflow: ellipsis;
						word-break: break-all;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
						overflow: hidden;
						height: 80rpx;
						margin-bottom: 8rpx;
						font-size: 22rpx;
						color: #666666;
						margin-top: 5rpx;
						.listType{
							color: #fff;
							background-color: #6954D5;
							padding: 4rpx 15rpx;
							border-radius: 8rpx;
							margin-right: 18rpx;
						}
						
					}

					.other {
						display: flex;
						align-items: center;
						font-size: 28rpx;
						color: #999;

						.left {
							display: flex;
							flex-direction: column;

							.source {
								color: #FF584B;

								text {
									font-size: 38rpx;
								}
							}
						}

						.right {
							margin-left: 20rpx;
							text {
								font-size: 20rpx;
								color: #999;
								text-decoration: line-through
							}
						}

					}
				}

				.photo {
					width: 100%;
					height: 360rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					overflow: hidden;
					image {
						width: 100%;
						
					}
				}
			}

			.line {
				display: bock;
				width: 100%;
				height: 1rpx;
				margin-top: 22rpx;
				background: #e8e8e8;
			}

			&:last-child {
				.line {
					//display: none;
				}

				//padding-bottom: 30rpx;
			}
		}
	}
	.nullList{
		text-align: center;
		color: #999
	}
</style>